<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="${BaseContext }">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>checkMaterial JSP</title>
	<!-- 引入css -->
	<link rel="stylesheet" href="assets/css/amazeui.min.css">
	<link rel="stylesheet" href="assets/css/app.css">
	<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
	
	<!-- 引入JQuery  js-->
	<script src="static/js/jquery-3.2.1.min.js"></script>
	<script src="assets/js/amazeui.min.js"></script>
</head>
<body>
	
	<div class="am-panel-group" id="accordion">
		<c:forEach items="${dataList }" var="material" varStatus="i">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd">
					<h4 class="am-panel-title" data-am-collapse="{parent: '#accordion', target: '#do-not-say-${i.count }'}">
						<span><i class="fas fa-angle-double-right"></i></span>&nbsp;&nbsp;&nbsp;
						${material.k }
						&nbsp;&nbsp;&nbsp;<span><i class="fas fa-angle-double-left"></i></span>
					</h4>
				</div>
				<div id="do-not-say-${i.count }" class="am-panel-collapse am-collapse">
					<div class="am-panel-bd">
						<c:if test="${empty material.v }">
							还没有提交相应材料文件!
						</c:if>
						<c:if test="${not empty material.v }">
							<a href="${material.v }" target="_blank">在线预览</a>
							<hr>
							<a href="javascript:;" materialPath="${material.v }" onclick="downloadFile(this);">下载查看</a>
						</c:if>
					</div>
				</div>
			</div>
		</c:forEach>
	</div>

<script type="text/javascript">
	//下载文件
	function downloadFile(obj){
		//alert($(obj).attr('materialPath'));
		var filePath = $(obj).attr('materialPath');
		alert('文件正在下载...');
		$.post('professor/downloadFile.do',{filePath:filePath},function(result){
			if(result.success){
				alert('文件下载成功\n本地地址为：'+result.downPath);
			}
		},'json');
	}
</script>
</body>
</html>